﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model.WXshopBuiness.DTO
{
    public class OrderInfoModel
    {
        ///<summary>
        ///订单ID
        ///<summary>
        public string OrderID { get; set; }

        public string OrderName { get; set; }
        ///<summary>
        /// 用户ID
        ///<summary>
        public string UserID { get; set; }
        ///<summary>
        ///订单编号
        ///<summary>
        public string OrderCode { get; set; }
        ///<summary>
        /// 创建时间
        ///<summary>
        public DateTime CreateTime { get; set; }

        public string StrCreateTime {
            get {
                return CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            }
        }
        ///<summary>
        ///订单金额
        ///<summary>
        public decimal OrderMoney { get; set; }

        public string StrOrderMoney {
            get {
                return OrderMoney.ToString("#0.00");
            }
        }
        ///<summary>
        ///订单来源
        ///0：微信商城
        ///10：微信外卖
        ///20：微信堂食
        ///<summary>
        public int OrderSource { get; set; }

        public string StrOrderSource {
            get {
                string temp=string.Empty;
                switch (OrderSource) {
                    case 0:temp = "微信商城"; break;
                    case 10: temp = "微信外卖"; break;
                    case 20: temp = "微信堂食"; break;
                }
                return temp;
            }
        }
        ///<summary>
        ///支付方式
        ///0：微支付
        ///5：微信扫码支付
        ///10：支付宝
        ///15：支付宝扫码支付
        ///20：银联支付         
        ///30：线下支付
        ///<summary>
        public int PayType { get; set; }

        public string StrPayType {
            get
            {
                string temp = string.Empty;
                switch (PayType)
                {
                    case 0: temp = "微支付"; break;
                    case 5: temp = "微信扫码支付"; break;
                    case 10: temp = "支付宝"; break;
                    case 20: temp = "银联支付"; break;
                    case 30: temp = "线下支付"; break;
                }
                return temp;
            }
        }
        ///<summary>
        ///收货地址ID
        ///<summary>
        public string AddressID { get; set; }
        ///<summary>
        ///订单状态
        ///0：购物车
        ///1：待支付
        ///5：已支付
        ///10：已发货
        ///15：已签收
        ///20：待评价
        ///30：已完成
        public int OrderState { get; set; }

        public string StrOrderState {
            get
            {
                string temp = string.Empty;
                switch (OrderState)
                {
                    case 0: temp = "待支付"; break;
                    case 1: temp = "待支付"; break;
                    case 5: temp = "已支付"; break;
                    case 10: temp = "已发货"; break;
                    case 15: temp = "已签收"; break;
                    case 20: temp = "待评价"; break;
                    case 30: temp = "已完成"; break;
                }
                return temp;
            }
        }
        ///<summary>
        ///备注
        ///<summary>
        public string Remark { get; set; }
        ///<summary>
        ///确认支付时间
        ///<summary>
        public DateTime? ConfirmTime { get; set; }
        ///<summary>
        ///确认支付状态
        ///<summary>
        public int ConfirmPayState { get; set; }
        ///<summary>
        ///发货时间
        ///<summary>
        public DateTime? SendGoodsTime { get; set; }
        ///<summary>
        ///发货人
        ///<summary>
        public string SendGoodsName { get; set; }
        ///<summary>
        ///签收时间
        ///<summary>
        public DateTime? SignTime { get; set; }
        ///<summary>
        ///联系人姓名
        ///<summary>
        public string UserName { get; set; }
        ///<summary>
        ///联系人电话
        ///<summary>
        public string Mobile { get; set; }
        ///<summary>
        ///区域代码
        ///<summary>
        public string AreaCode { get; set; }
        ///<summary>
        ///区域
        ///<summary>
        public string Area { get; set; }
        ///<summary>
        ///详细地址
        ///<summary>
        public string Detail { get; set; }
        ///<summary>
        ///快递商
        ///<summary>
        public string KDName { get; set; }
        ///<summary>
        ///快递单
        ///<summary>
        public string KDCode { get; set; }
        ///<summary>
        ///快递费
        ///<summary>
        public decimal KDMoney { get; set; }
        ///<summary>
        ///使用积分
        ///<summary>
        public decimal UseScore { get; set; }
        ///<summary>
        ///使用现金
        ///<summary>
        public decimal UseCash { get; set; }
        ///<summary>
        ///使用余额
        ///<summary>
        public decimal UseBalance { get; set; }
        ///<summary>
        ///使用优惠券
        ///<summary>
        public decimal UseCoupon { get; set; }
        ///<summary>
        ///订单类型
        ///<summary>
        public int OrderType { get; set; }
        ///<summary>
        ///订单赠送礼品
        ///<summary>
        public string OrderGift { get; set; }
        ///<summary>
        ///订单检查时间
        ///<summary>
        public DateTime? CheckTime { get; set; }
        ///<summary>
        ///订单检查结果
        ///<summary>
        public string CheckResult { get; set; }
        ///<summary>
        ///订单佣金金额
        ///<summary>
        public decimal OrderCommissionMoney { get; set; }
        ///<summary>
        ///省份编码
        ///<summary>
        public string Province { get; set; }
        ///<summary>
        ///市编码
        ///<summary>
        public string City { get; set; }
        ///<summary>
        ///0：商家订单未结算，1：已结算
        ///<summary>
        public int IsSettlement { get; set; }
        ///<summary>
        ///系统平台 标识那个平台 暂未使用
        ///<summary>
        public int Platform { get; set; }
        /// <summary>
        /// 产品ID
        /// </summary>
        public string ProductId { get; set; }
        /// <summary>
        /// 产品名
        /// </summary>
        public string ProductName { get; set; }
        /// <summary>
        /// 产品描述
        /// </summary>
        public string ShortDesc { get; set; }
        /// <summary>
        /// 产品图片
        /// </summary>
        public string ProductImg { get; set; }

        public string Domain { get; set; }
        /// <summary>
        /// 标价
        /// </summary>
        public decimal MarketPrice { get; set; }
        /// <summary>
        /// 成本价
        /// </summary>
        public decimal CostPrice { get; set; }
        /// <summary>
        /// 销售价
        /// </summary>
        public decimal SalePrice { get; set; }

        public string StrSalePrice
        {
            //get {
            //    if (string.IsNullOrEmpty(ProductSpecificationId))
            //    {
            //        return SalePrice.ToString("#0.00");
            //    }
            //    else {
            //        return SpeciSalesPrice.Value.ToString("#0.00");
            //    }

            //}
            get {
                return ThatTimeSalePrice.ToString("#0.00");
            }
        }
        /// <summary>
        /// 砍价之后的价格
        /// </summary>
        public string StrSalePriceAfterKJ {
            get {
                if (string.IsNullOrEmpty(ProductSpecificationId))
                {
                    return (SalePrice - (AleradKanJiaMoney.HasValue ? AleradKanJiaMoney.Value : 0.00M)).ToString("#0.00");
                }
                else
                {
                    return (SpeciSalesPrice.Value - (AleradKanJiaMoney.HasValue ? AleradKanJiaMoney.Value : 0.00M)).ToString("#0.00");
                }
            }
        }
        /// <summary>
        /// 订单原本需要支付总价格 销售价 +快递费
        /// </summary>
        public string OrderOrginPrice {
            get {
                if (string.IsNullOrEmpty(ProductSpecificationId))
                {
                    return ((ThatTimeSalePrice * ProductNum) + KDMoney - UseCoupon).ToString("#0.00");
                }
                else
                {
                    return ((ThatTimeSalePrice * ProductNum) + KDMoney - UseCoupon).ToString("#0.00");
                }
            }
        }
        /// <summary>
        /// 订单参与砍价之后的总价
        /// </summary>
        public string OrderPriceAfterKJ {
            get {
                if (string.IsNullOrEmpty(ProductSpecificationId))
                {
                    return ((ThatTimeSalePrice * ProductNum) + KDMoney - (AleradKanJiaMoney.HasValue ? AleradKanJiaMoney.Value : 0.00M) - UseCoupon).ToString("#0.00");
                }
                else
                {
                    return ((ThatTimeSalePrice  * ProductNum) + KDMoney - (AleradKanJiaMoney.HasValue ? AleradKanJiaMoney.Value : 0.00M) - UseCoupon).ToString("#0.00");
                }
            }
        }
        /// <summary>
        /// 库存
        /// </summary>
        public int Stock { get; set; }
        /// <summary>
        /// nick name
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 用户CODE
        /// </summary>
        public string UserCode { get; set; }
        /// <summary>
        /// 用户头像
        /// </summary>
        public string HeadUrl { get; set; }
        /// <summary>
        /// 数据库 分页查询时 查询结果总数
        /// </summary>
        public int Total { get; set; }

        public string Spec1 { get; set; }
        public string Spec2 { get; set; }
        public string Spec3 { get; set; }
        public string Spec4 { get; set; }
        public string Spec5 { get; set; }

        public int IsDel { get; set; } 
        public string AllSpec
        {
            get {
                return Spec1 + " " + Spec2 +" "+ Spec3 +" "+ Spec4 +" "+ Spec5;
            }
        }

        public string DetailAddress { get; set; }
        public string receivePhone { get; set; }
        public string Receiver { get; set; }
        public int? IsDefault { get; set; }
        public string Tag { get; set; }

        public string KanJiaID { get; set; }
        public bool HasKanJia {
            get {
                return !string.IsNullOrEmpty(KanJiaID);
            }
        }
        public string StrAleradKanJiaMoney { get {
                return AleradKanJiaMoney.HasValue ? AleradKanJiaMoney.Value.ToString("#0.00") : "0.00";
            } }
        public decimal? AleradKanJiaMoney { get; set; }

        public string Phone { get; set; }

        public string PromotionID { get; set; }

        public int ProductNum { get; set; }

        public string ShopCarId { get; set; }

        public string ProductSpecificationId { get; set; }
        public decimal ThatTimeSalePrice { get; set; }
        public decimal? SpeciSalesPrice { get; set; }
        public decimal? SpeciOrignPrice { get; set; }
        public decimal NeedToPay { get; set; }
        public string StrNeedToPay { get {
                return NeedToPay.ToString("#0.00");
            } }
    }
}
